#ifndef BLUEZMANAGER_H
#define BLUEZMANAGER_H
#include <QObject>
#include <KF5/BluezQt/bluezqt/device.h>
#include <KF5/BluezQt/bluezqt/initmanagerjob.h>
#include <KF5/BluezQt/bluezqt/request.h>
class BluezManager: public QObject
{
    Q_OBJECT
public:
    BluezManager(BluezQt::ManagerPtr, QObject* parent = nullptr);
private:
    class BluezManagerPrivate;
    BluezManagerPrivate* d_ptr;
signals:
    void switchPower(bool flag);
    void setAdapterName(const QString& name);
    void deviceConnected(bool flag);
public slots:
    void clickPower();
    void enablePairing();
    void disablePairing();
    /**
    * @brief  开始蓝牙扫描，建议设置5-30秒扫描间隔，避免过度耗电
    * @param
    * @return
    * @author        tangfulong
    * @date          2025-03-04
    */
    void startDiscovery();
    void stopDiscovery();
    void removeDevice(BluezQt::DevicePtr device);
private slots:
    void startServerFinished(BluezQt::PendingCall* call);
    void initJobFinished(BluezQt::InitManagerJob* job);
    void powerChanged(bool powered);
    void deviceChanged(BluezQt::DevicePtr device);
    void setCaptureAddress(const QString& address, bool connected);

};

#endif // BLUEZMANAGER_H
